home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / tcplusx.zip / MOUSE.H < prev    next >
C/C++ Source or Header  |  1991-02-28  |  4KB  |  149 lines

  1. #ifndef _MOUSE_H
  2. #define _MOUSE_H
  3.  
  4. //
  5. // mouse.h         - header file for class Mouse
  6. // Author        - Robin W. McKean
  7. // Last Update    - February 23,1991
  8. // Copyright (C) 1991 All rights reserved
  9. //
  10. // This file remains the property of the author, Robin W. McKean.  You are
  11. // free to use and change it as you see fit.  This module, nor its object
  12. // code, may not however be included  in any packaged software without the
  13. // written consent of the author.
  14. //
  15.  
  16. // Contents ----------------------------------------------------------------
  17. //
  18. //        Mouse
  19. //
  20. // Description
  21. //
  22. //        Defines the class Mouse.  The purpose of this class is to serve
  23. //        as input device for mouse actions.  This provides an integrated
  24. //        method of recieving and translating mouse and keyboard actions into
  25. //        events in a manner that is transparent to the user.
  26. //
  27. // End ---------------------------------------------------------------------
  28.  
  29. // Interface Dependencies ---------------------------------------------------
  30.  
  31. #ifndef _IOSTREAM_H
  32. #include <iostream.h>
  33. #define _IOSTREAM_H
  34. #endif
  35.  
  36. #ifndef _GEN_H
  37. #include <gen.h>
  38. #endif
  39.  
  40. #ifndef _USETYPES_H
  41. #include <usetypes.h>
  42. #endif
  43.  
  44. #ifndef _OBJECT_H
  45. #include <object.h>
  46. #endif
  47.  
  48. #ifndef _EVENT_H
  49. #include <event.h>
  50. #endif
  51.  
  52. #ifndef _DEVICE_H
  53. #include <device.h>
  54. #endif
  55.  
  56. // End Interface Dependencies ------------------------------------------------
  57.  
  58. // Class //
  59.  
  60. class Mouse : public Device
  61. {
  62. public:
  63.     Mouse( int initStatus = D_ON );
  64.     Mouse( Device& );
  65.     ~Mouse( void );
  66.  
  67.     classType        isA( ) const;
  68.     char            *nameOf( ) const;
  69.  
  70.     int             processA( Event& );
  71.     void            pollDevice( );
  72.  
  73.     void            setLines( unsigned char a_lines )
  74.                         { lines = a_lines; }
  75.     void            setColumns( unsigned char a_col )
  76.                         { columns = a_col; }
  77.     void            setCellHeight( unsigned char cellH )
  78.                         { cellHeight = cellH; }
  79.     void            setCellWidth( unsigned char cellW )
  80.                         { cellWidth = cellW; }
  81. private:
  82.     unsigned int    mouseButtonPressed;
  83.     unsigned char    cellWidth, cellHeight;
  84.     unsigned char    lines, columns;
  85.  
  86. };
  87.  
  88. // Description --------------------------------------------------------------
  89. //
  90. //        The mouse class does processes events from, what else, a mouse.
  91. //        It reads a two or three button mouse and translates the events it
  92. //      recieves into button presses, releases or continue selects.  See
  93. //        gen.h for a complete list of possible event types.
  94. //
  95. //    Constructor
  96. //
  97. //        Mouse( int initStatus = D_ON )
  98. //
  99. //        Initializes the device, and determines if a mouse is present on
  100. //        the computer.
  101. //
  102. //        Mouse( Mouse& )
  103. //
  104. //        Copy constructor, copies one device into another.  
  105. //
  106. //    Destructor
  107. //
  108. //        ~Mouse()
  109. //
  110. //        Turns the mouse off
  111. //
  112. //    Member Functions
  113. //
  114. //        isA( )
  115. //
  116. //        Returns character class type mouseClass
  117. //
  118. //        nameOf( )
  119. //
  120. //        Returns a character representation of class, "Mouse"
  121. //
  122. //        printOn( ostream& )
  123. //
  124. //        Prints the contents of the class in a logical fashion
  125. //
  126. //        processA( Event& )
  127. //
  128. //        Responsible for taking an event, and processing the contents if
  129. //        applicable to this device
  130. //
  131. //        pollDevice( )
  132. //
  133. //        Requests information from a device, and translated into an event
  134. //        which is fed directly into the event manager's queue.  
  135. //
  136. //    Inherited Members
  137. //
  138. //        isSortable( )        inherited from Object
  139. //        isAssociation( )    inherited from Object
  140. //        operator new        inherited from Object
  141. //        firstThat( )        inherited from Object
  142. //        lastThat( )         inherited from Object
  143. //        hashValue( )        inherited from Device
  144. //        isEqual( )            inherited from Device
  145. //
  146. // End Description ----------------------------------------------------------
  147.  
  148. #endif    // _MOUSE_H //
  149.